package sicau.car.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author ITcz
 * @Data 2020-09-16 - 11:27
 * 配置管理员登录验证和用户登录验证
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    AdminIntercepter adminIntercepter;

    @Autowired
    CorsInterceptor corsInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(corsInterceptor).addPathPatterns("/**");
        registry.addInterceptor(adminIntercepter).addPathPatterns("/admin/**").excludePathPatterns("/admin/loginIn")
                .excludePathPatterns("/admin/showNotice").excludePathPatterns("/admin/orderByCode").excludePathPatterns("/blueCard/*");
    }
}
